Skip to content

Conversation

@nathan-dovire
Copy link

@nathan-dovire nathan-dovire commented Dec 11, 2025

#5784

Completes the userPoolEndpoint Implementation

This PR completes completes the implementation started in commit f37cb7e69 which added userPoolEndpoint to AuthOutputs but was missing a critical mapping step.

Problem

The original work added the userPoolEndpoint field to support custom Cognito endpoints (e.g., routing through a proxy), but the implementation was incomplete. The endpoint was being collected from Gen 1 configs but never actually passed to the Cognito User Pool configuration.

Root Cause

The CognitoUserPoolConfig.fromAuthOutputs() factory method was missing the endpoint mapping, breaking the configuration flow:

// Missing in original PR:
endpoint: authOutputs.userPoolEndpoint

@nathan-dovire nathan-dovire requested a review from a team as a code owner December 11, 2025 08:36
@nathan-dovire nathan-dovire force-pushed the fix/auth-endpoints-complete-mapping branch from 4a1df7f to 0bf1039 Compare December 11, 2025 08:51
@nathan-dovire nathan-dovire changed the title Fix/auth endpoints complete mapping Fix Cognito Auth endpoints mapping Dec 11, 2025
@nathan-dovire nathan-dovire marked this pull request as draft December 11, 2025 09:58
@nathan-dovire nathan-dovire force-pushed the fix/auth-endpoints-complete-mapping branch from b79d900 to 83b9733 Compare December 11, 2025 11:07
@cadivus
Copy link
Contributor

cadivus commented Dec 16, 2025

Hi @nathan-dovire ,

Thank you for your contribution to the AWS Amplify Flutter Library! Is there a reason this Pull Request is still a draft?

@nathan-dovire
Copy link
Author

Hi @cadivus,
I’ve been testing this and noticed an issue with authentication when using the endpoint. Even after configuring the userPoolEndpoint, authentication still fails.

For context, in my use case authentication is handled via a custom auth endpoint that wraps the Cognito client. This Cognito client is protected by a client secret that is only available at runtime. The flow is:

  • A request is made to the custom auth endpoint.
  • That endpoint injects the Cognito client secret (provided at runtime).
  • The endpoint then redirects the request directly to the Cognito authentication endpoint.

With this setup, simply adding userPoolEndpoint to the configuration does not seem to be sufficient. The auth request directly hits the Cognito endpoint and fails to authenticate, which suggests the current implementation may not fully support Cognito flows where the authentication request is executed directly against Cognito rather than through the custom endpoint.

Importantly, this flow works as expected when testing against v1.8.*. However, after upgrading to v2.x and above, authentication breaks with the same configuration, which strongly suggests a regression introduced in v2+.

Please let me know if this behavior is expected, or if there’s additional configuration or a recommended integration pattern for this scenario. I’m happy to help investigate further or contribute a fix once the intended behavior is clear.

Thanks!

@cadivus
Copy link
Contributor

cadivus commented Jan 12, 2026

Hi @nathan-dovire ,
we just merged #6477 which is similar to your PR. How exactly and where are you configuring your Cognito endpoint?

The merged PR worked for us by setting the userPoolEndpoint like this directly in amplify_outputs.dart:
Screenshot 2026-01-12 at 14 51 06

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants